/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package IA;

import java.util.*;


/**
 *
 * @author Jeremy
 */
public class ChronologicalCookStrategy implements CookStrategy {

    @Override
    public ArrayList<CookItem> getNextOrders(ArrayList<CookItem> cookingItems, ArrayList<CookItem> queueItems, int NumNeeded) {
        ArrayList<CookItem> ItemsToReturn = new ArrayList<CookItem>();
        //make a copy of the queue so that it can ordered and manipulated without changing the original
        ArrayList<CookItem> Queue = (ArrayList<CookItem>) queueItems.clone();
        int NumFetched = 0;
        Iterator<CookItem> itr = Queue.iterator();
        while (NumFetched < NumNeeded && itr.hasNext()) {
            ItemsToReturn.add(itr.next());
            NumFetched++;
        }
        return ItemsToReturn;
    }
}
